package com.recognition.swing;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JPanel;

public class JVideoPanel extends JPanel
{
	private BufferedImage _img;

	public void setFrame(BufferedImage img)
	{
		_img = img;
		paintComponent(getGraphics());
	}	
	public void paintComponent(Graphics g)
	{		
		if (_img == null)
		{
			g.setColor(new Color(0, 0, 0));
			g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
		}
		else
		{
			if (_img.getWidth() < 200)
				g.drawImage(_img, 0, 0, 2*_img.getWidth(), 2*_img.getHeight(), null);	
			else
				g.drawImage(_img, 0, 0, _img.getWidth(), _img.getHeight(), null);	
		}
	}
}